{% extends 'base.html.twig' %}

{% block title %}Post index{% endblock %}

{% block body %}
    <h1>Post index</h1>

    <table class="table">
        <thead>
            <tr>
                <th>Id</th>
                <th>Title</th>
                <th>Slug</th>
                <th>Summary</th>
                <th>Content</th>
                <th>PublishedAt</th>
                <th>actions</th>
            </tr>
        </thead>
        <tbody>
        {% for post in posts %}
            <tr>
                <td>{{ post.id }}</td>
                <td>{{ post.title }}</td>
                <td>{{ post.slug }}</td>
                <td>{{ post.summary }}</td>
                <td>{{ post.content }}</td>
                <td>{{ post.publishedAt ? post.publishedAt|date('Y-m-d H:i:s') : '' }}</td>
                <td>
                    <a href="{{ path('app_post_show', {'id': post.id}) }}">show</a>
                    <a href="{{ path('app_post_edit', {'id': post.id}) }}">edit</a>
                </td>
            </tr>
        {% else %}
            <tr>
                <td colspan="7">no records found</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <a href="{{ path('app_post_new') }}">Create new</a>
{% endblock %}
